#include<bits/stdc++.h>

using namespace std;
using ll = long long;
#define endl '\n'

int main() {
    string s;
    while (getline(cin, s)) {
        int dot = 0;
        for (int i = 0; i < s.size(); i++) {
            if (s[i] == '.') {
                s[i] = ' ';
                ++dot;
            }
        }

        int a, b, c, d;
        istringstream iss(s);
        if (dot == 3 && iss >> a >> b >> c >> d
            && a >= 0 && a <= 255
            && b >= 0 && b <= 255
            && c >= 0 && c <= 255
            && d >= 0 && d <= 255) {
            cout << "Y" << endl;
        } else cout << "N" << endl;
    }
    return 0;
}